<script>
	$(function(){
		EBCMS.CORE.datadict({
			queryParams:{
				sort:'sort',
				order:'desc',
				datadict:'{$_field.config.datadict|default='Datadictcate'}',
			},
			<eq name='_field.config.rootitem' value='1'>
			rootitem:true,
			</eq>
			loadAfter:function(data){
				$select = $('#{$_ns}');
				var str = EBCMS.FN.renderSelect(data['rows'],'{$_field._value}','{$_field.config.valuefield|default="id"}','{$_field.config.textfield|default="title"}');
				$select.append(str);
			}
		});
	});
</script>
<eq name='_field.config.editable' value='1'>
	<div class="row">
		<div class="col-md-8">
			<input type="text" class="form-control" id="{$_ns}_obj" name="{$_field._field}" value="{$_field._value}" placeholder="{$_field.config.prompt|default=''}" <eq name='_field.config.readonly' value='1'>readonly</eq> <eq name='_field.config.disabled' value='1'>disabled</eq> <eq name='_field.config.required' value='1'>required</eq>>
		</div>
		<div class="col-md-4">
			<select class="form-control" id="{$_ns}" onchange="$('#{$_ns}_obj').val($(this).val());" <eq name='_field.config.readonly' value='1'>readonly</eq> <eq name='_field.config.disabled' value='1'>disabled</eq> <eq name='_field.config.required' value='1'>required</eq>>
			</select>
		</div>
	</div>
<else/>
	<select class="form-control" id="{$_ns}" name="{$_field._field}" <eq name='_field.config.readonly' value='1'>readonly</eq> <eq name='_field.config.disabled' value='1'>disabled</eq> <eq name='_field.config.required' value='1'>required</eq>>
	</select>
</eq>